package com.quartz;

import com.service.RefreshService;
import com.service.impl.RefreshServiceImpl;
import com.util.GetBeanInstance;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

public class ScheduledJob implements Job {
    private static Logger logger = LoggerFactory.getLogger(ScheduledJob.class);

    RefreshService refreshService = (RefreshServiceImpl) new GetBeanInstance().getBean("refreshServiceImpl");

    List<String> beanNames = new ArrayList<>();
     {
         beanNames.add("department");
         beanNames.add("yybBranch");
         beanNames.add("yybCity");
         beanNames.add("yybInfos");
         beanNames.add("yybProvince");
         beanNames.add("yybCityRelation");
         beanNames.add("vZgLm");
         beanNames.add("tFunddayIncome");
         beanNames.add("rygsFxckh");
         beanNames.add("rygsGy");
         beanNames.add("rygsJjxs");
         beanNames.add("rygsTzgw");
         beanNames.add("rygsYxry");
         beanNames.add("rygsZqjy");
     }

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        try {
            refreshService.synBYBeanNames(beanNames);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}